<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<script type="text/javascript">

$(function(){
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
	$("#username").formValidator({onshow:"请输入用户名",onfocus:"用户名应该为2-20位之间"}).inputValidator({min:2,max:20,onerror:"用户名应该为2-20位之间"});
	$("#email").formValidator({onshow:"请输入正确的E-mail",onfocus:"请输入正确的E-mail",oncorrect:"E-mail格式正确"}).regexValidator({regexp:"email",datatype:"enum",onerror:"E-mail格式错误"})<?php if(!$user):?>.ajaxValidator({
		type : "get",
		url : "/user/validate_email_ajax",
		data :"",
		datatype : "html",
		async:'false',
		success : function(data){	
            if( data == "true" )
			{
                return true;
			}
            else
			{
                return false;
			}
		},
		buttons: $("#dosubmit"),
		onerror : "用户名已存在。",
		onwait : "请稍候..."
		})<?php endif;?>;
//	$("#mobile").formValidator({empty:true,onshow:"手机号不填请留空",onfocus:"手机号只能由1开头11位数字"}).regexValidator({regexp:"mobile",datatype:"enum",onerror:"手机号格式错误"});
//	$("#phone").formValidator({empty:true,onshow:"电话号码不填请留空,电话号码格式：（地区号-）用户号（-分机号）如010-66668888-123",onfocus:"电话号码格式错误"}).regexValidator({regexp:"mobile",datatype:"enum",onerror:"电话号码格式错误"});
});

	$(function(){
			var is_d = <?php echo(!isset($user) || $user['is_designer']==0) ? 0 : 1; ?>;
			change_designer(is_d);
		});

	function change_designer(dd){
		if(dd==1){
			$('.isdesigner').css('display','');
		}else{
			$('.isdesigner').css('display','none');
		}
	}
</script>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo $user['is_partner'] == 1 ? U('user/partner') : U('user/user_list');?>'><em>会员列表</em></a><span>|</span>
        <a href='javascript:;' class="on"><em>编辑会员</em></a>
    </div>
</div>
<div class="pad_10">
<div class="common-form">
<form name="myform" action="__SELF__" method="post" id="myform"  enctype="multipart/form-data">
<table width="100%" class="table_form contentWrap">
<?php if(isset($user) && $user):?>
<tr>
<td width="80">用户名</td> 
<td><?php echo $user['username']?></td>
</tr>
<tr>
<td>会员使用语言</td>
<td><?php echo $user['language_name'];?></td>
</tr>
<?php else:?>
<tr>
<td width="80">用户名</td> 
<td><input type="text" name="username"  class="input-text" id="username"/></td>
</tr>
<?php endif;?>
<tr>
<td width="80">First name</td> 
<td><input type="text" name="first_name" class="input-text" id="first_name" value="<?php echo $user['first_name']?>"/></td>
</tr>
<tr>
<td width="80">Last name</td> 
<td><input type="text" name="last_name" class="input-text" id="last_name" value="<?php echo $user['last_name']?>"/></td>
</tr>
<tr>
<td width="80">会员头像</td> 
<td>
<input type="file" name="up_user_photo" value="上传">
<?php if($user['user_photo']):?>
<img src="<?php echo $user['user_photo']?>" width="80" height="80"/>
<?php endif;?>
<input type="hidden" name="user_photo" class="input-text" value="<?php echo $user['user_photo']?>"/>
</td>
</tr>
<?php if(isset($user) && $user):?>
<tr>
<td width="80">可用资金</td> 
<td><?php echo $user['user_money']?> <div class="infoShow">用户余额</div></td>
</tr>
<?php endif;?>
<tr >
<td width="80">等级积分</td> 
<td><?php echo $user['rank_points']?> <div class="infoShow">等级积分是一种累计的积分，系统根据该积分来判定用户的会员等级。</div></td>
</tr>
<tr >
<td width="80">消费积分</td> 
<td><?php echo $user['pay_points']?> <div class="infoShow">消费积分是一种站内货币，允许用户在购物时支付一定比例的积分。</div></td>
</tr>
<tr>
<td>会员等级</td>
<td><select name="rank_id">
<?php 
if(isset($rankList) && $rankList){
	foreach($rankList as $rank){
?>
<option value="<?php echo $rank['id']?>" <?php if($user['rank_id']==$rank['id'])echo'selected';?>><?php echo $rank['name']?></option>
<?php 
}	}
?>
</select></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="text" name="email" class="input-text" id="email" size="30" value="<?php echo $user['email']?>" <?php if($user):?> readonly="readonly"<?php endif;?></td>
</tr>
<tr>
<td>新密码</td> 
<td><input type="password" name="password" id="password" class="input-text"/></td>
</tr>
<tr>
<td>确认密码</td> 
<td><input type="password" name="pwdconfirm" id="pwdconfirm" class="input-text"/></td>
</tr>
<tr>
<td>性别</td>
<td><input type="radio" name="gender" value="0" <?php if($user['gender']==0)echo 'checked';?>/> 保密
<input type="radio" name="gender" value="1" <?php if($user['gender']==1)echo 'checked';?>/> 男 
<input type="radio" name="gender" value="2" <?php if($user['gender']==2)echo 'checked';?>/> 女 </td>
</tr>
<tr class="hidden">
<td>手机</td>
<td><input type="text" name="mobile" value="<?php echo $user['mobile']?>" class="input-text" id="mobile"/></td>
</tr>
<tr>
<td>电话/手机</td>
<td><input type="text" name="phone" value="<?php echo $user['phone']?>" class="input-text" id="phone"/></td>
</tr>

<tr>
<td>状态</td>
<td><input name="disabled" value="1" type="radio" <?php if(!isset($user) || $user['disabled']==1)echo 'checked';?>/> 开启    
<input name="disabled" value="0"  type="radio" <?php if($user['disabled']==0)echo 'checked';?> /> 禁用</td>
</tr>
<td>合作伙伴</td>
<td><input name="is_partner" value="1" type="radio" <?php if($user['is_partner']==1)echo 'checked';?> /> 是    
<input name="is_partner" value="0"  type="radio"  <?php if(!isset($user) || $user['is_partner']==0)echo 'checked';?>  /> 否</td>
</tr>
<tr>
<td>设计师</td>
<td><input name="is_designer" onclick="change_designer(1);" value="1" type="radio" <?php if($user['is_designer']==1)echo 'checked';?>/> 是    
<input name="is_designer" onclick="change_designer(0);" value="0"  type="radio" <?php if(!isset($user) || $user['is_designer']==0)echo 'checked';?> /> 否</td>
</tr>
<tr class="isdesigner">
<td width="80">设计师名称</td> 
<td><input type="text" name="nickname" class="input-text" value="<?php echo $user['nickname']?>"/></td>
</tr>
<tr class="isdesigner">
<td width="80">设计师LOGO</td> 
<td>
<input type="file" name="up_user_designer_logo" value="上传">
<?php if($user['designer']['user_designer_logo']):?>
<img src="<?php echo $user['designer']['user_designer_logo']?>" width="100" height="100"/>
<?php endif;?>
<input type="hidden" name="user_designer_logo" class="input-text" value="<?php echo $user['designer']['user_designer_logo']?>"/>
</td>
</tr>
<tr class="isdesigner">
<td width="80">设计师广告</td> 
<td>
<input type="file" name="up_user_designer_adv" value="上传">
<?php if($user['designer']['user_designer_adv']):?>
<img src="<?php echo $user['designer']['user_designer_adv']?>" height="100"/>
<?php endif;?>
<input type="hidden" name="user_designer_adv" class="input-text" value="<?php echo $user['designer']['user_designer_adv']?>"/>
</td>
</tr>
<tr class="isdesigner">
<td width="80">设计师简介</td> 
<td><textarea name="user_content" class="input-text" style="width:80%;height:100px;"><?php echo $user['designer']['user_content']?></textarea></td>
</tr>
<tr class="isdesigner">
<td width="80">设计师签名</td> 
<td><textarea name="user_description" class="input-text" style="width:80%;height:100px;"><?php echo $user['designer']['user_description']?></textarea></td>
</tr>
<tr>
<td width="80">特殊需求</td> 
<td><textarea name="require" class="input-text" style="width:400px;height:100px;"><?php echo $user['require']?></textarea></td>
</tr>
</table>

    <div class="bk15"></div>
    <input name="id" value="<?php echo $user['id']?>" type="hidden"/>
    <input name="dosubmit" type="submit" value="提交" class="button" id="dosubmit" />
</form>
</div>
</div>
</body>
</html>
